package com.framework.loippi.controller.api;

import com.framework.loippi.api.utils.ApiUtils;
import com.framework.loippi.entity.Agreement;
import com.framework.loippi.service.AgreementService;
import io.swagger.annotations.Api;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller("apiAgreementController")
@RequestMapping("/api/agreement")
@Api(tags = {"协议信息"})
public class AgreementController extends ApiBaseController {

    @Resource
    AgreementService agreementService;

    @RequestMapping(value = "/find.json", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public @ResponseBody
    String find() {
        Agreement agreement = agreementService.find(1L);

        return ApiUtils.success(agreement);
    }

    @RequestMapping(value = "/findRegisterText.json", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    String findRegisterText() {
        String text = agreementService.findRegisterText();
        return ApiUtils.success(text);
    }
}
